package com.javaweb.controller;

import com.javaweb.common.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @desc:
 * @author: Ping
 * @date: 2024/11/27 11:32
 */

@Controller
@Slf4j
public class UserController {

    @PostMapping("login")
    @ResponseBody
    public ResponseResult<String> login(@RequestBody UserVo user) {
        log.info("user: {}", user) ;
        if ("123456".equals(user.getPassword())) {
            log.info("login successfully." );
            return ResponseResult.ok("登录成功");
        }
        return ResponseResult.error("用户名或密码错误");


    }

}
